package web;

import java.io.IOException;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import domain.PropertyInc;
import repository.PropertyIncDAO;

@WebServlet("/PropertyIncll")
public class PropertyIncInc extends HttpServlet {
	private static final long serialVersionUID = 1L;
  
    public PropertyIncInc() {
        super();
    }

	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setCharacterEncoding("UTF-8");
		response.setContentType("text/html;charset=utf-8");
		
		PropertyInc allprop = new PropertyInc();
		
		allprop.setID(request.getParameter("ID"));
		allprop.setName(request.getParameter("name"));
		allprop.setPrice(request.getParameter("price"));
		allprop.setNumber(request.getParameter("number"));
		
		PropertyIncDAO alldao = null;
		try {
			alldao = new PropertyIncDAO();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		
		alldao.insert(allprop);
		request.getRequestDispatcher("PropertyIncDate.jsp").forward(request, response);
	}

	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request, response);
	}

}
